<template>
  <div class="pd-rl-10px text-left">
    <el-button  type="success" plain icon="el-icon-refresh" size="mini"  class="dis-lb mar-rl-10px"  @click="syncData">同步数据</el-button>
    <el-dialog title="选择日期同步" :visible.sync="dialogFormVisible" width="30%">
      <div class="text-center">
        <el-date-picker class="w-full"
            v-model="tradeDate"
            :type="tradeDateType"
            range-separator="至"
            start-placeholder="开始日期"
            :value-format="tradeDateType === 'date'?'yyyyMMdd': 'yyyy-MM-dd'"
            end-placeholder="结束日期">
        </el-date-picker>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible = false">取 消</el-button>
        <el-button type="primary" @click="confirmSync">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
export default {
  name: "TradeDateModel",
  props:{
    tradeDateType: {
      type: String ,
      default: "date"
    }
  } ,
  data(){
    return {
      dialogFormVisible: false ,
      tradeDate: ""
    }
  },
  methods:{
    syncData(){
      this.dialogFormVisible = true ;
    },
    confirmSync(){
      this.dialogFormVisible = false ;
      this.$emit("confirmTradeDate" , this.tradeDate)
    }
  }
}
</script>

<style scoped>

</style>
